﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;

namespace Cubicle.Core.DataContracts
{
    [DataContract]
    [Serializable]
    public class ConstructorData
    {
        [DataMember]
        public List<ParameterData> Parameters;

        public static ConstructorData Create(ConstructorInfo c)
        {
            var cData = new ConstructorData();
            cData.Parameters = c
                .GetParameters()
                .Select((p, i) => ParameterData.Create(i, p))
                .ToList();
            return cData;
        }
    }
}